public class TestThread3 implements Runnable {
    private String threadName;
    public TestThread3(String threadName){
        this.threadName=threadName;
    }
    public void run(){
        //线程体
        for (int i = 0; i < 20; i++) {
            System.out.println(threadName+i);
        }
    }

    public static void main(String[] args) {
        //创建Runnable接口的实现类对象
        TestThread3 testThread31=new TestThread3("我是线程一");
        TestThread3 testThread32=new TestThread3("我是线程二");
        //通过线程对象来开启线程
        new Thread(testThread31).start();
        new Thread(testThread32).start();
    }
}
